<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="按钮1" onclick="f1()">
<button onclick="f2('貂蝉',18)">按钮2</button>


<script>
    //无参无返回值
    function f1() {
        alert("f1");
    }
    //调用方法
    //f1();
    //有参无返回值
    function f2(name, age) {
        console.log(name + ":" + age);
    }

    f2("刘备", 30);

    //无参有返回值
    function f3() {
        return "我是返回值";
    }
    let info = f3();
    console.log(info);
    //有参有返回值
    function f4(x, y) {
        return x * y;
    }
    let result = f4(5, 9);
    console.log(result);

    //第二种声明方法的方式
    let f5 = function (name,age) {
        console.log(name+":"+age);
    }
    f5("关羽",20);
    //第三种声明方法的方式
    let f6 = new Function("name","age","console.log(name+':'+age)");
    f6("张飞",10);




</script>
</body>
</html>